package com.pescamillam.kidsmath;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import com.google.ads.*;

public class KidsMathActivity extends Activity {
	private AdView adView;
	Context context = KidsMathActivity.this;
	
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //load items
        
        //ad
        adView = new AdView(this, AdSize.BANNER, "a14eaeb3d03c19a");
        
        RelativeLayout layout = (RelativeLayout)findViewById(R.id.mainLayout);
        RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
//        p.addRule(RelativeLayout.BELOW, R.id.terminal);
//      p.addRule(RelativeLayout.ALIGN_BASELINE);
        adView.setLayoutParams(p);
        layout.addView(adView,p);
        AdRequest request = new AdRequest();
//      request.setTesting(true);
        adView.loadAd(request); 
        
        //create listener
//        primaNav.setOnCheckedChangeListener(listener);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.game_menu, menu);
        return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
            case R.id.exit:
            	//moves the application to the back
                moveTaskToBack(true);
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
    
}